﻿using System;
using Core.Library;
using DataObject.Cart;

public partial class Controls_Common_ShoppingCartCollapsable : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            ListSmallCart();
    }

    private void ListSmallCart()
    {
        var lstCart = ShoppingCart.Instance.Items;
        if (lstCart.Count > 0)
        {
            rptSmallCart.DataSource = lstCart;
            rptSmallCart.DataBind();

            ltTotalCart1.Text = Utils.FormatPrice(ShoppingCart.Instance.GetSubTotal());
            ltTotalCart2.Text = Utils.FormatPrice(ShoppingCart.Instance.GetSubTotal());
            ltQuantity.Text   = Utils.FormatPrice(lstCart.Count);
        }
    }
}